/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author ...
* @date 2020-11-08
**/
@Entity
@Data
@Table(name="shuyi_reserve_list")
public class ReserveList implements Serializable {

    private static final long serialVersionUID = 745704652109527490L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "reserve_list_id")
    @ApiModelProperty(value = "预约编号,自增长 ")
    private Integer reserveListId;

    @Column(name = "real_book_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "真实图书编号 ")
    private Integer realBookId;

    @Column(name = "reserve_time",nullable = false)
    @NotNull
    @ApiModelProperty(value = "预约时间 ")
    private Timestamp reserveTime;

    @Column(name = "reader_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "读者编号 ")
    private Integer readerId;

    @Column(name = "status",nullable = false)
    @NotNull
    @ApiModelProperty(value = "0:预约中 1:预约成功 2:预约失败 3:预约结束 4:交易中(自提方式)  5:交易中(物流方式) ")
    private Integer status;

    @Column(name = "delivery_id")
    @ApiModelProperty(value = "快递寄送编号 ")
    private Integer deliveryId;

    @Column(name = "is_circulate")
    @ApiModelProperty(value = "0:在书易中流通   1：仅在图书馆 ")
    private Boolean isCirculate;

    @Column(name = "holder_id")
    @ApiModelProperty(value = "持书者id ")
    private Integer holderId;

    @Column(name = "address_id")
    @ApiModelProperty(value = "地址编号 关联预约者的地址 ")
    private Integer addressId;

    @Column(name = "type")
    @ApiModelProperty(value = "type")
    private Integer type;

    @Column(name = "mode")
    @ApiModelProperty(value = "模式 0自提 1:快递 2:面对面 ")
    private Integer mode;

    @Column(name = "is_pay")
    @ApiModelProperty(value = "是否已支付订单:0，未支付 1,已支付 ")
    private Boolean isPay;

    @Column(name = "is_enable",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否启用 1启用 0未启用")
    private Boolean isEnable;

    public void copy(ReserveList source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}